/**
 * 
 */
package clids.ex2.filescript;

import java.text.ParseException;
import java.util.Date;

/**
 * @author Li0r
 *
 */
public class ToolBox {

	private static String sourceDir;
	
	/**
	 * @throws ParseException 
	 * 
	 */
	public static boolean ParseYesNo(String param) throws ParseException{
		String lowcaseParam = param.toLowerCase();
		if(lowcaseParam.equals("yes")){
			return true;
		}
		if(lowcaseParam.equals("no")){
			return false;
		}
		throw new ParseException("no yes", 0);  
	
	}
	
	
	public static double convertFileSizeKB(long numOfBytes) {
		return (1.0 * numOfBytes)/1024;
	}
	
	public static String convertDate (long fileModDate) {
		return (new Date(fileModDate).toString());
	}
	
	public static void setSourceDir(String source) {
		sourceDir = source;
	}
	
	public static String getSourceDir () {
		return sourceDir;
	}
}
